<?php
shunxu(4);
function shunxu($max_num){
    include_once( 'config.php' );
    $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); 
    mysql_select_db(DB_NAME,$con);
    mysql_query("SET NAMES utf8");
    $sql="select * from cai_shunxu where id =1"; 
    $result=mysql_query($sql);
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $num_data=$row['num']+1;
    if($max_num<=$num_data){
        $num_data = 0;
    }
    echo $num_data;
    $sql2="UPDATE `cai_shunxu` SET `num` ='".$num_data."' WHERE  id='1'";
    $result2=mysql_query($sql2);
    if($result2){
        echo '----';
    }else{
        echo '++++';
    }  
}

?>